package com.qidian.buy.controller;

import com.qidian.buy.pojo.ItemCategory;
import com.qidian.buy.service.ItemCategoryService;
import com.qidian.buy.util.pojo.QdResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 戴着假发的程序员
 * @company 起点编程
 * @date 2023/9/8 9:42
 */
@RestController
@RequestMapping("/itemCat")
public class ItemCategoryController {
    @Autowired
    private ItemCategoryService categoryService;

    @PostMapping("/save")
    public QdResult save(@RequestBody ItemCategory category){
        return categoryService.save(category);
    };

    @GetMapping("/queryByParentId")
    public QdResult queryByParentId(Long parentId){
        return categoryService.queryByParentId(parentId);
    }
}
